package com.acme.bankapp.domain.bank;

public class CheckingAccount extends AbstractAccount {

	private double overdraft;	
	public CheckingAccount(final double amount, final double overdraft) {
		super(amount);
		this.overdraft = overdraft;
	}
	
	public CheckingAccount() { 
		this(0, 1000);
	}
	
	public double maximumAmountToWithdraw() {
		return this.balance + overdraft;
	}
	
	public void deposit(final double amount) {
		if(amount <= 0) {
			System.out.println("amount < 0");
			return;
		} 
		this.balance += amount;	
	}
	
	public void withdraw(final double amount) {
		if(amount <= 0) {
			System.out.println("amount < 0");
			return;
		}
		if ((this.balance + overdraft) < amount) {
			System.out.println("there is not enough money");
			return;
		}
		this.balance -= amount;		
	}

}
